import { post, get, _delete, put } from '@/lin/plugin/axios'

class Collector {
  static async addCollector(data) {
    const res = await post('v1/Collector', data)
    return res
  }

  static async getDetail(id) {
    const res = await get(`v1/Collector/${id}`)
    return res
  }

  static async editCollector(id, data) {
    const res = await put(`v1/Collector/${id}`, data)
    return res
  }

  static async deleteCollector(id) {
    const res = await _delete(`v1/Collector/${id}`)
    return res
  }

  static async Collector1(data) {
    const res = await get('v1/Collector/getCollector')
    return res
  }
  static async Collector2(data) {
    const res = await get('v1/Collector/getCollector1')
    return res
  }
  // static async getCollectors(page = 0, count = 10) {
  //   const res = await get('v1/Collector/page', { page, count })
  //   return res
  // }

  // static async search({keyword,page,count}){
  //   const res = await get('v1/Collector/search',{
  //     keyword,
  //     page,
  //     count
  //   })
  //   return res
  // }
 
  static async getCollectors({StartTime1,EndTime1,StartTime2,EndTime2,page,count,dwmc,bgateway_name,collector_name,
    collector_state,
    group_id,
    dwmc1,
    bgateway_name1,
    collector_name1,
    collector_state1,
    group_id1,
    dwmc2,
    bgateway_name2,
    collector_name2,
    collector_state2,
    group_id2,
    dwmc3,
    bgateway_name3,
    collector_name3,
    collector_state3,
    group_id3,
    dwmc4,
    bgateway_name4,
    collector_name4,
    collector_state4,
    group_id4,}) {
    const res = await get('v1/view-collector/page', { 
      StartTime1,
      EndTime1,
      StartTime2,
      EndTime2,
      page, 
      count,
      dwmc,
      bgateway_name,
      collector_name,
      //垃圾
      collector_state,
      group_id,
      dwmc1,
      bgateway_name1,
      collector_name1,
      collector_state1,
      group_id1,
      dwmc2,
      bgateway_name2,
      collector_name2,
      collector_state2,
      group_id2,
      dwmc3,
      bgateway_name3,
      collector_name3,
      collector_state3,
      group_id3,
      dwmc4,
      bgateway_name4,
      collector_name4,
      collector_state4,
      group_id4,
    })
    return res
  }

  static async search({keyword,StartTime1,EndTime1,StartTime2,EndTime2,page,count,dwmc,bgateway_name,collector_name,
    collector_state,
    group_id,
    dwmc1,
    bgateway_name1,
    collector_name1,
    collector_state1,
    group_id1,
    dwmc2,
    bgateway_name2,
    collector_name2,
    collector_state2,
    group_id2,
    dwmc3,
    bgateway_name3,
    collector_name3,
    collector_state3,
    group_id3,
    dwmc4,
    bgateway_name4,
    collector_name4,
    collector_state4,
    group_id4,}){
    const res = await get('v1/view-collector/search',{
      keyword,
      StartTime1,
      EndTime1,
      StartTime2,
      EndTime2,
      page,
      count,
      dwmc,
      bgateway_name,
      collector_name,

      collector_state,
      group_id,
      dwmc1,
      bgateway_name1,
      collector_name1,
      collector_state1,
      group_id1,
      dwmc2,
      bgateway_name2,
      collector_name2,
      collector_state2,
      group_id2,
      dwmc3,
      bgateway_name3,
      collector_name3,
      collector_state3,
      group_id3,
      dwmc4,
      bgateway_name4,
      collector_name4,
      collector_state4,
      group_id4,
    })
    return res
  }
}

export default Collector
